Sig/M	Volume 48	Communication Utilities
			Miscellaneous CP/M Support 

		-CATALOG.048	contents of Sig/M volume 48
				released November 25, 1981
		ACKLIST.048	acknowledgement file
		CRCKLIST.048	checksum of Sig/M volume 48

index	name		size	description

48.01	CARRY12 .ASM	 6K	pause prior to load of .COM files	
48.02	MODEM7  .DOC	16K	update of Modem7 program
48.03	MODEM7  .LIB	14K	   /
48.0´	MODEM·  .SEÔ	 3Ë	  / 
48.05	MODEM73 .ASM	63K	 /      
48.06	MODEM73 .OBJ	10K	/	      
48.07	SENDOUT3.ASM	 5K	sendout utility for PMMI
48.08	UNSPOOL .ASM	13K	DESPOOL look-alike
48.09	UNSPOOL .DOC	 8K	/
48.10	USRDFLT2.CCP	15K	pseudo CCP User
48.11	USRPW34 .ASM	17K	password for User access control
48.12	XMODEM46.ASM	39K	remote CP/M file transfer program
48.13	SQ      .COM	14K	pack ASCII file
48.14	USQ     .COM	10K	unpack ASCII file

Copyright (C) 1981 by Sig/M-Amateur Computer Group
of New Jersey Inc., Box 97, Iselin NJ 08830-0097

              CP/M MODEM PROGRAM DOCUMENTATION
	    by Mark M. Zeiger and James K. Mills
			  11/04/80

This  program  uses  the  file transfer routines  written  by  Ward 
Christensen  in his CP/M file transfer program (V2.0 as of  8/6/79) 
and  is  compatable with his program in single file transfer  mode. 
Multi-file transfers are only possible between two systems  running 
the program described below.

This program has three functions:

        1.  Communication
        2.  Program transfer
        3.  Modem control (for PMMI Modem)


COMMUNICATIONS

The program may emulate a terminal or echo data back to sender (act
as a computer).

Terminal Mode  -  'T' Option

        The  terminal mode may be called with or without a file  name. 
        If  a  file  is  specified (it should be  a  new  file),  then 
        anything  received  by the modem may be saved  in  memory  and 
        later  written on disk.  The save feature is toggled ON/OFF by 
        Control-Y.  On  an IMSAI the front panel LEDs  will  indicated 
        that  memory save is toggled on by showing the binary value of 
        the ASCII character received. For those with no front panel, a 
        colon  (:) will be printed at the beginning of each line  when 
        memory save is active.  The colon will not be transmitted over 
        the modem nor will it be saved in memory.

        If  a  file  is not specified,  then memory save  can  not  be 
        activated.

        If  the memory buffer is full (the buffer is from the  top  of 
        the  program  to  the  bottom  of  BDOS),   the  contents  are 
        automatically  written  to  disk  (but the  file  is  not  yet 
        closed).  Communications  may  then continue with  the  buffer 
        reinitialized.  The  computer with which you are communicating 
        must  accept  the  X-ON and X-OFF  (Control-Q  and  Control-S) 
        conventions or data will be lost.

        When  communications are over,  use Control-E to exit from the 
        Terminal  mode and enter the Menu.  The file to which you  are 
        writing  must then be closed by using the  'WRT'  command.  If 
        this  is  not done,  all data will be lost.  I decided not  to 
        close  the file automatically since there will be  times  when 
        you leave terminal mode and then decide to re-enter.  This may 
        be done while in the Menu by using the 'RET' command.  You may 
        re-enter Terminal mode and save in the same file as many times 
        as  you wish as long as you have not closed the file with  the 
        'WRT' command.

        While  in  Terminal  mode,  Control-T will  put  you  in  File 
        Transfer mode.  This will allow you to send the contents of an 
        ASCII file over the modem. This routine does no error checking 
        and  there are no protocols specified between this program and 
        the  receiving computer other than that it should be ready  to 
        receive  data  via  the  modem.   Control-X  will  cancel  the 
        transfer.


Computer mode - 'E' Option

        This  mode  echos data received by other  computer.  Only  one 
        computer  may be in this mode at one time.  There is  no  save 
        feature  in this mode.  Useful if you wish to communicate with 
        somebody running the terminal portion of the program.

File transfer - 'S' and 'R' Options

        These  features  are  the same as in the  CP/M  Modem  program 
        written by Ward Christensen except that upon completion of the 
        transfer, control returns to the Menu unless the secondary 'T' 
        option has been selected.  In the latter case, control returns 
        to Terminal mode.  Remember that if you are operating a remote 
        computer   using   a  timesharing  program   (such   as   Ward 
        Christensen's "BYE"),  the remote should be instructed to send 
        or  receive  in  the  quiet (Q) mode as  a  secondary  option. 
        Examples  of  commands for sending and  receiving  are  listed 
        below.

Multi-file transfers

        Using  the B (batch) secondary option,  more than one file and 
        ambiguous filenames may be transferred. To send files, use the 
        primary  option  "S" and the secondary option "B" (along  with 
        any  other  secondary options and baudrate).  To  receive  the 
        files  being  sent,  use the "R" primary option  and  the  "B" 
        secondary  option.  Files may not be named since filenames are 
        sent by the sending program, but a disk drive may be specified 
        (or else the files are written to the default drive).

Backup option

        There  is  a byte at the beginning of the program (106H)  that 
        will  create a backup file if a file on the disk has the  same 
        name  as the file being received in multi-file  transfer  (see 
        MODEM.SET). If this byte is set to 0FFH, a backup file will be 
        created.  If  it is zero the file on the disk will be  deleted 
        before the new file is received. If you are running CP/M 2 and 
        a file on the disk is designated R/O or SYS,  a backup will be 
        created whether the byte at 106H is set or not.

        Be  careful - if you are running CP/M 1 and the drive on which 
        you  are receiving has an R/O file with the same name  created 
        by CP/M 2,  the R/O file can not be accessed (found,  changed, 
        erased,  etc.)  by CP/M 1.  You will therefore have two  files 
        with  the same name when you are running CP/M 2.  To fix  this 
        problem, use CP/M 1 to change the name of the file that is not 
        R/O. Then use CP/M 2 to do what you want with the R/O file.

        Examples:

        The  sender enters    SBOT.600 B:*.COM    to send all the  COM 
        files on disk B.  Also specified were originate mode 600  baud 
        (PMMI modem) and return to terminal mode when done.

        The  receiver enters     RBA.600    to receive all  the  files 
        being  sent on the default drive (also answer mode at 600 baud 
        for PMMI).


        The sender enters the command   SB.600  ASM.COM  *.HEX  B:M*.*
        which  will send ASM.COM from the default drive,  all the  HEX 
        files from the default drive,  and all the files starting with 
        "M" from the B drive.  [note that neither 'A' or 'O' were
	specified: default is to whatever mode the PMMI is in
	currently]

        Multifile transfers may only be done from the menu. It may not 
        be specified when the MODEM program is called.  In other words    
        A>MODEM  SAB  *.COM   will result in an INVALID  OPTION  error 
        message.


Return to Menu - 'M' option

        When asked to select an option, 'M' returns to Menu.

The MENU

        If  the Modem program is entered with no option,  the Menu  is 
        called.  The  Menu gives the choice of selecting the  standard 
        options as defined by Ward Christensen (T,  E,  R, and S). The 
        Terminal  mode has been greatly expanded as  described  above. 
        The "R" and "S" commands must be called with a filename or you 
        will be required to enter the primary command (S or R) and the 
        filename  again (but NOT the secondary options).  If you  want 
        multi-file  transfers,  then  the "R" option does not  need  a 
        filename.

  RET - You may also enter terminal mode using the 'RET' command,  but 
        no  data  will  be saved since a file may not  be  named  with 
        'RET'.  Use  the 'RET' command to RE-ENTER Terminal mode after 
        it  has  first been entered with the 'T' option.  If  this  is 
        done, you will still be able to save the communications if you 
        were doing so before you exitted the terminal mode.

  WRT - The  'WRT' command must be used after leaving  Terminal  mode. 
        This  writes  the  last buffer to disk and  closes  the  file. 
        Failure  to use the 'WRT' command results in loss of all  data 
        and a file of length zero.

  DEL - The  'DEL'  command  erases the most recent file  accessed  in 
        Terminal mode.  Useful if you decide after communications that 
        you don't want to save information just gathered.

  CPM - The 'CPM' command reboots and returns to CP/M.

  XPR - The  'XPR'  command is a toggle which causes the  menu  to  be 
        printed  or not printed.  Initially the menu is on unless  the 
        program is called with the "X" option (ie.  A>MODEM X ).

  DIR - The 'DIR' command lists the directory of a CP/M disk.  A drive 
        may  be specified (ie.  DIR B:) or the default drive  will  be 
        listed.  After  the directory is listed,  the menu will not be 
        printed whether XPR mode is on or off.  If XPR mode is on  and 
        you wish to see the menu, hit return.

FOR THE PMMI MODEM

  DSC - To disconnect you must use the 'DSC' command in the Menu.

        The original secondary options for the PMMI Modem (as  defined 
        by  Ward  Christensen) are "A" (answer mode),  "O"  (originate 
        mode), and baudrate selection. See examples below.

        Once  answer  or originate and a baudrate have  been  selected 
        (ie.  SO.450  NAME.TYP),  any subsequent options will use  the 
        same mode and buadrate. If you want to change the baudrate, it 
        may be done without changing the mode.  For instance,  if  you 
        are  in  originate mode at 450 baud,  then the command  'R.600 
        NAME.TYP'  will  allow you to receive a file at  600  baud  in 
        ORIGINATE mode.  If you want to change the ans/orig mode, then 
        you MUST select the baudrate again or it will default to 300.


  CAL - Allows  dialing  of number.  If a connection to a computer  is 
        established,  you  will  be able to  select  options  (usually 
        TO.xxx).   If no connection is made after 15 seconds, [changed
	to  25  seconds  in  distributed  version]     then  you  will 
        be  informed and be given the option of redialing or returning 
        to the menu.  The dial routine may also be specified when  the 
        Modem  program is called by entering  A>MODEM C.  No secondary 
        options will be accepted when the "C" option is used.   [Note:
	you cannot type:  CAL 312-545-8086  --  well, you can, but the
	number will be ignored and you will have to retype it when the
	program asks for it   --   in  the  latest  version  (11/4/80)
	there is a 'library' feature such as in DIAL.ASM.   To use the
	CAL function, type CAL and a return at the menu.  You will see
	a message   'WAITING FOR DIAL TONE'  then a lot of stuff about
	entering the number.   At this point you may type in a number,
	or  you  may  type  a  letter  which will designate one of the
	library numbers (which you must insert at assembly time).

  ^B -  Control-B  while  in Terminal (or Echo) mode allows change  of 
        baudrate "on-the-fly." A carriage return gives 300  baud;  all 
        other rates (110-600) must be explicitely stated.


LISTING OF COMMANDS AND OPTIONS

    Primary options

        S - send a CP/M file (must specify file/s)
        R - receive  a CP/M file (must name file unless B sec opt used)
        T - terminal mode (specify file if memory save wanted)
        E - terminal mode with echo
        M - return to menu
        X - used only when program is called to initially
            toggle menu off

    Secondary options

        B - multi-file mode for sending and receiving files
        T - return to terminal mode after transfer (memory save off)
        R - view what is received in file transfer
        S - view what is being sent in file transfer
        V - view what is being sent or received in file transfer
        T - Terminal mode (used with remotely controlled computer)
        O - originate mode (PMMI modem)
        A - answer mode (PMMI modem)
        .xxx - baud rate xxx (xxx = 110-600  PMMI modem)

EXAMPLES        (fn = filename,  ft = filetype)

        Send file, originate mode, 300 baud

                                   SO fn.ft

        Send another file, same mode and baudrate

                                   S fn.ft

        Receive  file on B drive,  600 baud,  ans mode,  view what  is 
        being received, return to terminal mode 

                               RART.600 B:fn.ft

        Send all COM files, no messages on console, same baud and mode 
        as last transfer

                                  SBQ *.COM

        Send two files from two different drives

                           SB A:fn1.ft1  B:fn2.ft2

        Receive files being sent by above on drive A (baudrate must be 
        same and modes opposite)

                                    RB A:

        Terminal mode,  save communication in file,  300 baud (default 
        rate),  originate mode (in terminal must type CTRL-Y to  start 
        save, in menu must type "WRT" to close file)

                                   TO fn.ft


ASSEMBLING THE PROGRAM

        You  must use Digital Researches' MAC to assemble the program. 
        The  files required are MODEM.ASM and  MODEM.LIB.   MACROS.LIB 
        does not actually contain any macros in the true sense, but it 
        does  contain  routines  that are necessary for the program to
	run (MFACCESS however does use nested macros as real macros).

        If you have a PMMI and an IMSAI,  you may assemble the file as 
        is.  If  you do not have an IMSAI with a front  panel,  change 
        IMSAIBYTE  to 'FALSE' (near the beginning of the program).  If 
        you  wish another character instead of the colon  to  indicate 
        when  memory  save  is active,  change "MVI A,':'  "  to  "MVI 
        A,'char'  " in the "TERM" routine where 'char' is the printing 
        character  you would like at the beginning of each  line  when 
        memory save is active.

        If you do not have a PMMI,  change the byte to 'FALSE' and put 
        your  modem status and data ports in the appropriate  equates. 
        The  labels  'MODRCVR'  and 'MODSNDR' should be  the  same  as 
        MODRCVB  and  MODSNDB  (the  bits tested) if  your  UART  uses 
        positive  logic  (JZ)  and should be zero if  your  UART  uses 
        negative  logic.  If you have a Z-80 (or maybe a  fast  8085), 
        change  the  'FASTCLK' byte to 'TRUE'.  If any port  or  modem 
        initialization must be done, put the initialization routine in 
        the  area  labeled INITMOD (replacing the PMMI  initialization 
        routine). See MODEM.SET for more details.

        If  you  have  a D.C.  Hayes Modem,  you may  incorporate  the 
        routines from MODEM.ASM V2.0 (as of 8/6/79).

        You  should also note the comment in the INBUFF  routine  near 
        the end of the program.

        Any problems or bugs, please call me:

				Or latest revisor:
        Mark M. Zeiger		James K. Mills
        198-01B 67th Ave.	824 Jordan Place
        Flushing, N.Y. 11365	Rockford, IL  61108
        (212) 454-6985		(815) 398-0579


UNSPOOL.ASM			81-11-12
for CP/M 2.0 and up.

AUTHOR:			Gary P. Novosielski

INTRODUCTION:

	UNSPOOL (Ver 2.3) is a program to send a standard
CP/M file such as a .PRN or .ASM file to the system's list
or punch device, while still allowing other system operations
to take place.  The file is transferred during periods when
console is waiting for input.

SYNTAX:

	UNSPOOL [d:]filename.ext [dev]
	[square brackets denote optional parameters]

	Where	d:		is an optional drive spec
				such as A: or B:.  If not
				entered, the current default
				drive is assumed.

		filename.ext	is the name of the CP.M file
				to be printed/punched

		dev		is the symbolic name of the
				output device to be used.
				Valid devices are LST and
				PUN.  Note that the colon (:)
				usually present in these names
				is NOT entered.  If not
				specified, the LST: device is
				assumed.
Examples:
	UNSPOOL TEST.PRN
		will send the file TEST.PRN from the current
default drive to the current LST: device.

	UNSPOOL A:TEST.PRN LST
		is exactly equivalent to the above, assuming
drive A is the default drive.  Note that the device name has no
trailing colon.

	UNSPOOL B:ZINGER.HEX PUN
		will send the file ZINGER.HEX from the B drive
to the current PUN: device regardless of which drive is
currently the default.  Note that the device is "PUN"
not "PUN:".

OPERATION:

	Upon loading, the program checks to see that the
the BIOS vector table pointed to by the word at location
0001H is valid, i.e. is a table of JMP instructions containing
at least 16 entries.  If an error is detected, the program
will display an error message on the console and attempt to
warm-boot CP/M.
	If found, the BIOS vector table is copied into the
program segment which will remain active during unspooling
so that subsequent application programs running concurrently
with UNSPOOL will still have access to the BIOS.
	The address of the old BIOS vector table, the BDOS
entry address, and the CCP return address (from the top of the
stack on entry) are saved in memory.
	The "dev" parameter from the command line is checked.
If not valid, an error message is typed and control returns
to the CCP.
	The file named in the command line is opened for
input.  If not present, the filename is echoed to the console
followed by a "?" and control returns to CCP.
	If the drive is not explicit, the current default
drive number is recorded internally in case the default drive
is changed while UNSPOOL is active.
	The current user number and IOBYTE values are checked
and stored internally so that if the user number is changed,
UNSPOOL will still be able to read the input file.  If the
device is changed (using STAT LST:=TTY: for example) unspool
will continue to use the physical device in effect at the
time the program was initiated.  Any application programs
will, however, use the new values of the user number and the
new physical device assignments.
	If no errors were detected, the active program segment
which monitors all calls to BDOS is relocated into high memory
just below the CCP.  This reduces the available user program
area by 2.75 K:  3 pages for the UNSPOOL supervisor segment,
and 8 pages for the CCP which is commonly overwritten by user
program buffers.  The BOOT and BDOS jumps in low memory are
modified to protect the CCP and UNSPOOL supervisor segment.
	Control is then returned to the console.  Normal
CP/M operation will then be possible. Characters will be
sent from the input file to the output device whenever the
console is idle.

	Whenever an application program or the CCP requests
console input using BDOS functions 1 or 10, the supervisor
segment intercepts these requests and checks to see if the
console is idle.  If it is, characters are transferred from
the input file to the output device until the console becomes
ready, i.e. a key is actually pressed.  At that time the
BDOS function is executed normally, and control returns to the
application program.
	If a jump to BOOT is attempted, this is also
intercepted by the UNSPOOL supervisor segment.  The message
"Unspooling in progress" is displayed on the console, and
no actual boot takes place.  Control is returned to the
protected copy of the CCP instead.  Before returning, a disk
reset is performed and the default DMA address is reset to
0080H to simulate a true warm-boot as closely as possible.
	When the input file is completely transferred, or
a 1AH end-of-file character is detected, the supervisor
becomes inactive, and passes on all BDOS requests immediately,
without checking console status.  When the next warm-boot
request is detected, the supervisor removes itself from memory
by executing a true warm-boot, and informs the operator with
the message "UNSPOOL completed.".

NOTES:

	While UNSPOOL makes every effort to restore the values
of the DMA address, USER number, IOBYTE, and default disk drive
before returning control to the program, a hardware reset may
leave these values in an undetermined state if unspooling was
actually taking place at the time.
	The supervisor will not intercept a call to BDOS
function 0.  This will cause a true warm boot to occurr,
terminating unspool immediately.  Normally application programs
should reboot by jumping to location 0000H, not by calling
BDOS function 0.
	When function 10, Read Console Buffer is used, UNSPOOL
will transfer characters only until the first key is pressed.
At that time, no characters will be transferred until the
input line is completed by pressing a carriage return.
	UNSPOOL requires that the List Status function in
the BIOS was properly implemented at system installation time.
UNSPOOL will not send characters to the LST: device unless it
recieves a ready condition from the List Status routine.  If
the PUN: device is used, no status check is provided for by
CP/M, so a not-ready condition on the punch may cause the
system to hang up if PUN was specified on the command line.
See the CP/M Alteration Guide for a discussion of the BIOS
List Status routine.
	Although the console is polled frequently during the
unspooling of the file, some of the diskette operations may
take a second or two to complete, for example when a new extent
is opened.  Since the console is not polled during this period,
high speed typing may cause one or more characters to be lost.
This effect will vary depending upon the program being run,
the types of input reqests (character or line) it uses, and
the relative locations on diskette of the spool file and any
files in use by the program.  As a result, heads-down typing
is not reccommended while UNSPOOL is running.  Some experience
with UNSPOOL will teach the user when caution is required.

INSTALLATION:

	The source file is written for assembly with the
MAC assembler.  The .HEX file produced is LOADed to a .COM
file and executed just as any normal program.  Relocation is
done at execution time as described above.
	If the assembly option EXPAND is set to TRUE, tab
characters in the input file will be expanded to spaces with
assumed tab stops at every eighth print position.  This option
should be set to FALSE if the printer driver or the printer
itself can properly handle the tab character.  If the option
PHYSBS is set to TRUE, a backspace character will cause the
tab expansion algorithm to recognize backspace characters
and decrement the column count when a backspace is encountered
in the input file.  This option should be set to FALSE if
backspace characters are ignored by the printer.  All other
control codes except carriage return are assumed to be non-
printing, and are ignored by the algorithm.
	If tab expansion is included, the version number
in the signon message will be followed by "/T".

			Gary Novosielski
